package com.tj.template.application.user.input;

import com.fqgj.common.api.ParamsObject;
import com.tj.bo.common.conf.util.ParamsValidateUtil;
import com.tj.bo.user.client.enums.UserRegisterTypeEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * @program: binary-option
 * @description
 * @author: frank
 * @create: 2020-08-20 11:43
 **/
public class UserPromotionRegisterRequest extends ParamsObject {

    /**
     * 注册类型 0：手机号 1：邮箱
     */
    private Integer type;
    /**
     * 登录名称
     */
    private String loginAccount;
    /**
     * 密码
     */
    private String password;
    /**
     * 验证码
     */
    private String verifyCode;
    /**
     * 邀请码
     */
    private String inviteCode;

    public String getInviteCode() {
        return inviteCode;
    }

    public UserPromotionRegisterRequest setInviteCode(String inviteCode) {
        this.inviteCode = inviteCode;
        return this;
    }

    public Integer getType() {
        return type;
    }

    public UserPromotionRegisterRequest setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getLoginAccount() {
        return loginAccount;
    }

    public UserPromotionRegisterRequest setLoginAccount(String loginAccount) {
        this.loginAccount = loginAccount;
        return this;
    }

    public String getPassword() {
        return password;
    }

    public UserPromotionRegisterRequest setPassword(String password) {
        this.password = password;
        return this;
    }

    public String getVerifyCode() {
        return verifyCode;
    }

    public UserPromotionRegisterRequest setVerifyCode(String verifyCode) {
        this.verifyCode = verifyCode;
        return this;
    }

    @Override
    public void validate() {
        ParamsValidateUtil.checkParams(UserRegisterTypeEnum.getEnum(type) == null, "type is invalid");
        ParamsValidateUtil.checkParams(StringUtils.isBlank(loginAccount), "login account can't be empty");
        ParamsValidateUtil.checkParams(StringUtils.isBlank(password), "password can't be empty");
        ParamsValidateUtil.checkParams(StringUtils.isBlank(verifyCode), "verify code can't be empty");
        ParamsValidateUtil.checkParams(StringUtils.isBlank(inviteCode), "inviteCode code can't be empty");
    }
}
